import {asyncRoutes} from '../routes'
const hasPermission=(route,roles)=>{
  if(route.meta && route.meta.roles){
    return route.meta.roles.some(role=>roles.includes(role))
  }
  return true
}
export const genAsyncRoutes=(roles)=>{
   const result =[]
   asyncRoutes.forEach(routes=>{
    if(hasPermission(routes,roles)){
      result.push(routes)
    }
  })
  return result
}